HttpClientEndpoint{ }
HttpClientEndpoint{ }
writeRequest{
final class OnConnect {
    public ChannelFuture onConnect(    final ChannelFuture cf){
      return cf.getChannel().write(request);
  ConcurrentLinkedQueue<Object> messages=new ConcurrentLinkedQueue<Object>();
  messageList.put(id,messages);
  if (request.isChunked()) {
    request.removeHeader(HttpHeaders.Names.CONTENT_LENGTH);
  final OnConnect onConnect=new OnConnect();
  ChannelFuture future=getChannelFuture();
  if (future != null) {
      workingChannels.put(id,future.getChannel());
      future.getChannel().write(request).addListener(new HandleEvent(id));
      messages.offer(request);
      future.addListener(new HandleEvent(id));
    messages.offer(request);
    final ChannelFuture cf=newChannelFuture();
    cf.addListener(new HandleEvent(id));
}
onConnect{
  return cf.getChannel().write(request);
}
HandleEvent{ }
operationComplete{
  final ConcurrentLinkedQueue<Object> messages=messageList.get(id);
  if (messages != null) {
    Object message=messages.poll();
    if (message != null) {
      if (channelFuture.getChannel().isConnected()) {
        workingChannels.put(id,channelFuture.getChannel());
        if ((message instanceof HttpRequest && !((HttpRequest)message).isChunked()) || (message instanceof HttpChunk && ((HttpChunk)message).isLast())) {
          workingChannels.remove(id);
          messageList.remove(id);
 else {
          future.addListener(new HandleEvent(id));
 else {
        channelFuture.addListener(new HandleEvent(id));
}
writeChunk{
  final ConcurrentLinkedQueue<Object> messages=messageList.get(messageId);
  if (messages == null) {
  if (messages.isEmpty()) {
    Channel channel=workingChannels.get(messageId);
    if (channel != null) {
      if (channel.isConnected()) {
        if (log.isDebugEnabled()) {
        channel.write(chunk).addListener(new HandleEvent(messageId));
 else {
 else {
    if (log.isDebugEnabled()) {
}
getChannelFuture{
      return null;
    final ChannelFuture cf=openChannels.remove();
    if (cf != null && cf.isSuccess() && !cf.getChannel().isConnected()) {
      return null;
}
newChannelFuture{
  if (log.isDebugEnabled()) {
  ClientBootstrap cb=configuration.getClientBootStrap();
  final ChannelFuture future=cb.connect(new InetSocketAddress(host,port));
  future.getChannel().setAttachment(this);
}
responseDone{
  if (!close) {
synchronized (openChannels) {
      openChannels.offer(future);
 else {
      future.addListener(ChannelFutureListener.CLOSE);
}
